package com.test.mooan.labama.bean_boom.process_boom;

import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.test.mooan.labama.utils_boom.Stringutil_boom;

import java.util.ArrayList;


public class ProcessStep_boom {

    private ProcessStep_boom(){}

    private String apiUrl;
    private JsonArray dataList;
    private JsonArray extDataList;
    private String topTips;
    private String itemCount;
    private String isContact;
    private String contactParamName;
    private ArrayList<ArrayList<String>> relationShips;


    public String gApiUrl() {
        return Stringutil_boom.getSafeString(apiUrl);
    }

    public int gDataListSize(){
        if (dataList==null) return 0;
        return dataList.size();
    }

    public ProcessData_boom gProcessData(int index){
        if (index<0||index>=dataList.size()) return null;
        return new Gson().fromJson(dataList.get(index).toString(), ProcessData_boom.class);
    }

    public int gExtDataListSize(){
        if (extDataList == null) return 0;
        return extDataList.size();
    }

    public ProcessData_boom gExtProcessData(int index){
        if (index<0||index>=extDataList.size()) return null;
        return new Gson().fromJson(extDataList.get(index).toString(), ProcessData_boom.class);
    }

    public int gItemCount() {
        return Stringutil_boom.safeParseInt(itemCount);
    }

    public boolean isContact() {
        return Stringutil_boom.getSafeString(isContact).equalsIgnoreCase("YES");
    }

    public String gContactParamName() {
        return Stringutil_boom.getSafeString(contactParamName);
    }

    public ArrayList<String> gRelationShips(int index) {
        if (relationShips==null||relationShips.size()<=index) return new ArrayList<>();
        return relationShips.get(index);
    }

    public String gTopTips(){
        return Stringutil_boom.getSafeString(topTips);
    }

}
